﻿using LinnerToolkit.Core.Codec;
using SimulationPTSystem.EnvironmentDevice.Enums;
using System;
using System.Collections.Generic;
using System.Text;

namespace SimulationPTSystem.EnvironmentDevice.Codec
{
    /// <summary>
    /// 环境设备数据
    /// </summary>
    public class EnvironmentDeviceData : IDecodeData, IEncodeData
    {
        /// <summary>
        /// 设备类型
        /// </summary>
        public DeviceType DeviceType { get; set; }
        /// <summary>
        /// 设备编号
        /// </summary>
        public byte DeviceId { get; set; }
        /// <summary>
        /// 设备状态
        /// </summary>
        public DeviceStatus DeviceStatus { get; set; }

        /// <summary>
        /// 转换成byte数组
        /// </summary>
        /// <returns></returns>
        public byte[] ToBytes()
        {
            return new byte[] { 0xAA, 0x55, (byte)DeviceType, DeviceId, (byte)DeviceStatus, 0x0D, 0x0A };
        }
    }
}
